package main

import "fmt"

func generateNature() chan int {
	ch := make(chan int)
	go func() {
		for i := 2; i < 100; i++ {
			ch <- i
		}
	}()
	return ch
}

func primeFilter(ch chan int, prim int) chan int {
	out := make(chan int)
	for {
		if i := <-ch; i%prim != 0 {
			out <- i
		}
	}
}

func main() {
	ch := generateNature()
	for i:=0; i<100; i++ {
		prime := <-ch
		fmt.Printf("%v: %v\n", i+1, prime)
		ch = primeFilter(ch, prime)
	}
}